
<!doctype html>
<html lang="en" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
        <meta name="description" content="DataRecorder是个用于记录数据到文件工具集。使用方便，代码简洁，可靠、省心且实用。支持多线程同时写入文件。">
      
      
        <meta name="author" content="g1879">
      
      
        <link rel="canonical" href="http://g1879.gitee.io/DataRecorder/usage/Recorder/">
      
      
        <link rel="prev" href="../introduction/">
      
      
        <link rel="next" href="../DBRecorder/">
      
      
      <link rel="icon" href="../../assets/images/favicon.png">
      <meta name="generator" content="mkdocs-1.5.2, mkdocs-material-9.2.8">
    
    
      
        <title>🐯 Recorder - DataRecorder</title>
      
    
    
      <link rel="stylesheet" href="../../assets/stylesheets/main.046329b4.min.css">
      
        
        <link rel="stylesheet" href="../../assets/stylesheets/palette.85d0ee34.min.css">
      
      
  
  
    
    
  
    
    
  
    
    
  
    
    
  
    
    
  
    
    
  
    
    
  
    
    
  
    
    
  
    
    
  
    
    
  
    
    
  
  
  <style>:root{--md-admonition-icon--note:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M1 7.775V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 0 1 0 2.474l-5.026 5.026a1.75 1.75 0 0 1-2.474 0l-6.25-6.25A1.752 1.752 0 0 1 1 7.775Zm1.5 0c0 .066.026.13.073.177l6.25 6.25a.25.25 0 0 0 .354 0l5.025-5.025a.25.25 0 0 0 0-.354l-6.25-6.25a.25.25 0 0 0-.177-.073H2.75a.25.25 0 0 0-.25.25ZM6 5a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z"/></svg>');--md-admonition-icon--abstract:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M2.5 1.75v11.5c0 .138.112.25.25.25h3.17a.75.75 0 0 1 0 1.5H2.75A1.75 1.75 0 0 1 1 13.25V1.75C1 .784 1.784 0 2.75 0h8.5C12.216 0 13 .784 13 1.75v7.736a.75.75 0 0 1-1.5 0V1.75a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13.274 9.537v-.001l-4.557 4.45a.75.75 0 0 1-1.055-.008l-1.943-1.95a.75.75 0 0 1 1.062-1.058l1.419 1.425 4.026-3.932a.75.75 0 1 1 1.048 1.074ZM4.75 4h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM4 7.75A.75.75 0 0 1 4.75 7h2a.75.75 0 0 1 0 1.5h-2A.75.75 0 0 1 4 7.75Z"/></svg>');--md-admonition-icon--info:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"/></svg>');--md-admonition-icon--tip:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3.499.75a.75.75 0 0 1 1.5 0v.996C5.9 2.903 6.793 3.65 7.662 4.376l.24.202c-.036-.694.055-1.422.426-2.163C9.1.873 10.794-.045 12.622.26 14.408.558 16 1.94 16 4.25c0 1.278-.954 2.575-2.44 2.734l.146.508.065.22c.203.701.412 1.455.476 2.226.142 1.707-.4 3.03-1.487 3.898C11.714 14.671 10.27 15 8.75 15h-6a.75.75 0 0 1 0-1.5h1.376a4.484 4.484 0 0 1-.563-1.191 3.835 3.835 0 0 1-.05-2.063 4.647 4.647 0 0 1-2.025-.293.75.75 0 0 1 .525-1.406c1.357.507 2.376-.006 2.698-.318l.009-.01a.747.747 0 0 1 1.06 0 .748.748 0 0 1-.012 1.074c-.912.92-.992 1.835-.768 2.586.221.74.745 1.337 1.196 1.621H8.75c1.343 0 2.398-.296 3.074-.836.635-.507 1.036-1.31.928-2.602-.05-.603-.216-1.224-.422-1.93l-.064-.221c-.12-.407-.246-.84-.353-1.29a2.425 2.425 0 0 1-.507-.441 3.075 3.075 0 0 1-.633-1.248.75.75 0 0 1 1.455-.364c.046.185.144.436.31.627.146.168.353.305.712.305.738 0 1.25-.615 1.25-1.25 0-1.47-.95-2.315-2.123-2.51-1.172-.196-2.227.387-2.706 1.345-.46.92-.27 1.774.019 3.062l.042.19a.884.884 0 0 1 .01.05c.348.443.666.949.94 1.553a.75.75 0 1 1-1.365.62c-.553-1.217-1.32-1.94-2.3-2.768L6.7 5.527c-.814-.68-1.75-1.462-2.692-2.619a3.737 3.737 0 0 0-1.023.88c-.406.495-.663 1.036-.722 1.508.116.122.306.21.591.239.388.038.797-.06 1.032-.19a.75.75 0 0 1 .728 1.31c-.515.287-1.23.439-1.906.373-.682-.067-1.473-.38-1.879-1.193L.75 5.677V5.5c0-.984.48-1.94 1.077-2.664.46-.559 1.05-1.055 1.673-1.353V.75Z"/></svg>');--md-admonition-icon--success:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"/></svg>');--md-admonition-icon--question:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.92 6.085h.001a.749.749 0 1 1-1.342-.67c.169-.339.436-.701.849-.977C6.845 4.16 7.369 4 8 4a2.756 2.756 0 0 1 1.637.525c.503.377.863.965.863 1.725 0 .448-.115.83-.329 1.15-.205.307-.47.513-.692.662-.109.072-.22.138-.313.195l-.006.004a6.24 6.24 0 0 0-.26.16.952.952 0 0 0-.276.245.75.75 0 0 1-1.248-.832c.184-.264.42-.489.692-.661.103-.067.207-.132.313-.195l.007-.004c.1-.061.182-.11.258-.161a.969.969 0 0 0 .277-.245C8.96 6.514 9 6.427 9 6.25a.612.612 0 0 0-.262-.525A1.27 1.27 0 0 0 8 5.5c-.369 0-.595.09-.74.187a1.01 1.01 0 0 0-.34.398ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"/></svg>');--md-admonition-icon--warning:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"/></svg>');--md-admonition-icon--failure:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M2.344 2.343h-.001a8 8 0 0 1 11.314 11.314A8.002 8.002 0 0 1 .234 10.089a8 8 0 0 1 2.11-7.746Zm1.06 10.253a6.5 6.5 0 1 0 9.108-9.275 6.5 6.5 0 0 0-9.108 9.275ZM6.03 4.97 8 6.94l1.97-1.97a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l1.97 1.97a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-1.97 1.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L6.94 8 4.97 6.03a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018Z"/></svg>');--md-admonition-icon--danger:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M9.504.43a1.516 1.516 0 0 1 2.437 1.713L10.415 5.5h2.123c1.57 0 2.346 1.909 1.22 3.004l-7.34 7.142a1.249 1.249 0 0 1-.871.354h-.302a1.25 1.25 0 0 1-1.157-1.723L5.633 10.5H3.462c-1.57 0-2.346-1.909-1.22-3.004L9.503.429Zm1.047 1.074L3.286 8.571A.25.25 0 0 0 3.462 9H6.75a.75.75 0 0 1 .694 1.034l-1.713 4.188 6.982-6.793A.25.25 0 0 0 12.538 7H9.25a.75.75 0 0 1-.683-1.06l2.008-4.418.003-.006a.036.036 0 0 0-.004-.009l-.006-.006-.008-.001c-.003 0-.006.002-.009.004Z"/></svg>');--md-admonition-icon--bug:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M4.72.22a.75.75 0 0 1 1.06 0l1 .999a3.488 3.488 0 0 1 2.441 0l.999-1a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.775.776c.616.63.995 1.493.995 2.444v.327c0 .1-.009.197-.025.292.408.14.764.392 1.029.722l1.968-.787a.75.75 0 0 1 .556 1.392L13 7.258V9h2.25a.75.75 0 0 1 0 1.5H13v.5c0 .409-.049.806-.141 1.186l2.17.868a.75.75 0 0 1-.557 1.392l-2.184-.873A4.997 4.997 0 0 1 8 16a4.997 4.997 0 0 1-4.288-2.427l-2.183.873a.75.75 0 0 1-.558-1.392l2.17-.868A5.036 5.036 0 0 1 3 11v-.5H.75a.75.75 0 0 1 0-1.5H3V7.258L.971 6.446a.75.75 0 0 1 .558-1.392l1.967.787c.265-.33.62-.583 1.03-.722a1.677 1.677 0 0 1-.026-.292V4.5c0-.951.38-1.814.995-2.444L4.72 1.28a.75.75 0 0 1 0-1.06Zm.53 6.28a.75.75 0 0 0-.75.75V11a3.5 3.5 0 1 0 7 0V7.25a.75.75 0 0 0-.75-.75ZM6.173 5h3.654A.172.172 0 0 0 10 4.827V4.5a2 2 0 1 0-4 0v.327c0 .096.077.173.173.173Z"/></svg>');--md-admonition-icon--example:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M5 5.782V2.5h-.25a.75.75 0 0 1 0-1.5h6.5a.75.75 0 0 1 0 1.5H11v3.282l3.666 5.76C15.619 13.04 14.543 15 12.767 15H3.233c-1.776 0-2.852-1.96-1.899-3.458Zm-2.4 6.565a.75.75 0 0 0 .633 1.153h9.534a.75.75 0 0 0 .633-1.153L12.225 10.5h-8.45ZM9.5 2.5h-3V6c0 .143-.04.283-.117.403L4.73 9h6.54L9.617 6.403A.746.746 0 0 1 9.5 6Z"/></svg>');--md-admonition-icon--quote:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M1.75 2.5h10.5a.75.75 0 0 1 0 1.5H1.75a.75.75 0 0 1 0-1.5Zm4 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5ZM2.5 7.75v6a.75.75 0 0 1-1.5 0v-6a.75.75 0 0 1 1.5 0Z"/></svg>');}</style>



    
    
      
    
    
      
        
        
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
        <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
      
    
    
    <script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      

    
    
    
  </head>
  
  
    
    
      
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="teal" data-md-color-accent="indigo">
  
    
    
      <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#_1" class="md-skip">
          Skip to content
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
    
      

  

<header class="md-header md-header--shadow md-header--lifted" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="Header">
    <a href="../.." title="DataRecorder" class="md-header__button md-logo" aria-label="DataRecorder" data-md-component="logo">
      
  
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg>

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            DataRecorder
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              🐯 Recorder
            
          </span>
        </div>
      </div>
    </div>
    
      
        <form class="md-header__option" data-md-component="palette">
  
    
    
    
    <input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="teal" data-md-color-accent="indigo"  aria-label="Switch to dark mode"  type="radio" name="__palette" id="__palette_1">
    
      <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_2" hidden>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"/></svg>
      </label>
    
  
    
    
    
    <input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="teal" data-md-color-accent="indigo"  aria-label="Switch to light mode"  type="radio" name="__palette" id="__palette_2">
    
      <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12c0-2.42-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"/></svg>
      </label>
    
  
</form>
      
    
    
    
      <label class="md-header__button md-icon" for="__search">
        
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
        
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="Search">
        
        <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
          
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
        </button>
      </nav>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list" role="presentation"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
      <div class="md-header__source">
        <a href="https://gitee.com/g1879/DataRecorder" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    Gitee
  </div>
</a>
      </div>
    
  </nav>
  
    
      
<nav class="md-tabs" aria-label="Tabs" data-md-component="tabs">
  <div class="md-grid">
    <ul class="md-tabs__list">
      
        
  
  
  
    <li class="md-tabs__item">
      <a href="../.." class="md-tabs__link">
        
  
    
  
  欢迎

      </a>
    </li>
  

      
        
  
  
  
    <li class="md-tabs__item">
      <a href="../../installation_and_import/" class="md-tabs__link">
        
  
    
  
  安装和导入

      </a>
    </li>
  

      
        
  
  
    
  
  
    
    
      <li class="md-tabs__item md-tabs__item--active">
        <a href="../introduction/" class="md-tabs__link">
          
  
  使用方法

        </a>
      </li>
    
  

      
        
  
  
  
    <li class="md-tabs__item">
      <a href="../../history/" class="md-tabs__link">
        
  
    
  
  版本历史

      </a>
    </li>
  

      
        
  
  
  
    <li class="md-tabs__item">
      <a href="https://gitee.com/g1879/DataRecorder/issues" class="md-tabs__link">
        
  
    
  
  意见建议

      </a>
    </li>
  

      
    </ul>
  </div>
</nav>
    
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    


  


<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="../.." title="DataRecorder" class="md-nav__button md-logo" aria-label="DataRecorder" data-md-component="logo">
      
  
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg>

    </a>
    DataRecorder
  </label>
  
    <div class="md-nav__source">
      <a href="https://gitee.com/g1879/DataRecorder" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    Gitee
  </div>
</a>
    </div>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
  
  
  
    <li class="md-nav__item">
      <a href="../.." class="md-nav__link">
        
  
  <span class="md-ellipsis">
    欢迎
  </span>
  

      </a>
    </li>
  

    
      
      
  
  
  
    <li class="md-nav__item">
      <a href="../../installation_and_import/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    安装和导入
  </span>
  

      </a>
    </li>
  

    
      
      
  
  
    
  
  
    
    
    
    <li class="md-nav__item md-nav__item--active md-nav__item--nested">
      
        
        
        
        
        <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" checked>
        
          <label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
            
  
  <span class="md-ellipsis">
    使用方法
  </span>
  

            <span class="md-nav__icon md-icon"></span>
          </label>
        
        <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="true">
          <label class="md-nav__title" for="__nav_3">
            <span class="md-nav__icon md-icon"></span>
            使用方法
          </label>
          <ul class="md-nav__list" data-md-scrollfix>
            
              
                
  
  
  
    <li class="md-nav__item">
      <a href="../introduction/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    💬 概览
  </span>
  

      </a>
    </li>
  

              
            
              
                
  
  
    
  
  
    <li class="md-nav__item md-nav__item--active">
      
      <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
      
      
      
        <label class="md-nav__link md-nav__link--active" for="__toc">
          
  
  <span class="md-ellipsis">
    🐯 Recorder
  </span>
  

          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <a href="./" class="md-nav__link md-nav__link--active">
        
  
  <span class="md-ellipsis">
    🐯 Recorder
  </span>
  

      </a>
      
        

<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#_1" class="md-nav__link">
    🐘 创建对象
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_2" class="md-nav__link">
    ➕ 添加数据
  </a>
  
    <nav class="md-nav" aria-label="➕ 添加数据">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_3" class="md-nav__link">
    ✔ 记录单个数据
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_4" class="md-nav__link">
    ✔ 接收一行多个数据
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_5" class="md-nav__link">
    ✔ 接收多行数据
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_6" class="md-nav__link">
    🧾 指定工作表
  </a>
  
    <nav class="md-nav" aria-label="🧾 指定工作表">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_7" class="md-nav__link">
    📃 指定默认工作表
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_8" class="md-nav__link">
    📃 每个数据独立指定工作表
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_9" class="md-nav__link">
    💾 写入文件
  </a>
  
    <nav class="md-nav" aria-label="💾 写入文件">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_10" class="md-nav__link">
    ✍ 自动写入
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_11" class="md-nav__link">
    ✍ 手动写入
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_12" class="md-nav__link">
    ⚠️ 注意事项
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_13" class="md-nav__link">
    📑 文件格式
  </a>
  
    <nav class="md-nav" aria-label="📑 文件格式">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_14" class="md-nav__link">
    🔖 自动识别文件格式
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_15" class="md-nav__link">
    🔖 手动指定文件格式
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_16" class="md-nav__link">
    💡 示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_17" class="md-nav__link">
    🌺 设置单元格样式
  </a>
  
    <nav class="md-nav" aria-label="🌺 设置单元格样式">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_18" class="md-nav__link">
    ☘️ 跟随上一行
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_19" class="md-nav__link">
    ☘️ 指定样式
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#recorder" class="md-nav__link">
    ♾️ Recorder 对象的方法
  </a>
  
    <nav class="md-nav" aria-label="♾️ Recorder 对象的方法">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#add_data" class="md-nav__link">
    📌 add_data()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#record" class="md-nav__link">
    📌 record()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#clear" class="md-nav__link">
    📌 clear()
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#recorder_1" class="md-nav__link">
    ⚙️ Recorder 对象参数设置
  </a>
  
    <nav class="md-nav" aria-label="⚙️ Recorder 对象参数设置">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#setpath" class="md-nav__link">
    📌 set.path()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setcache_size" class="md-nav__link">
    📌 set.cache_size()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setfile_type" class="md-nav__link">
    📌 set.file_type()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#settable" class="md-nav__link">
    📌 set.table()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#sethead" class="md-nav__link">
    📌 set.head()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setbefore" class="md-nav__link">
    📌 set.before()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setafter" class="md-nav__link">
    📌 set.after()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setstyle" class="md-nav__link">
    📌 set.style()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setcol_height" class="md-nav__link">
    📌 set.col_height()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setfollow_styles" class="md-nav__link">
    📌 set.follow_styles()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setfit_head" class="md-nav__link">
    📌 set.fit_head()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setencoding" class="md-nav__link">
    📌 set.encoding()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setdelimiter" class="md-nav__link">
    📌 set.delimiter()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setquote_char" class="md-nav__link">
    📌 set.quote_char()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setshow_msg" class="md-nav__link">
    📌 set.show_msg()
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#recorder_2" class="md-nav__link">
    🔣 Recorder 对象的属性
  </a>
  
    <nav class="md-nav" aria-label="🔣 Recorder 对象的属性">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#path" class="md-nav__link">
    📌 path
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#type" class="md-nav__link">
    📌 type
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#data" class="md-nav__link">
    📌 data
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#cache_size" class="md-nav__link">
    📌 cache_size
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#table" class="md-nav__link">
    📌 table
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#encoding" class="md-nav__link">
    📌 encoding
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#delimiter" class="md-nav__link">
    📌 delimiter
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#quote_char" class="md-nav__link">
    📌 quote_char
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#before" class="md-nav__link">
    📌 before
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#after" class="md-nav__link">
    📌 after
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#show_msg" class="md-nav__link">
    📌 show_msg
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
    </ul>
  
</nav>
      
    </li>
  

              
            
              
                
  
  
  
    <li class="md-nav__item">
      <a href="../DBRecorder/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    🐨 DBRecorder
  </span>
  

      </a>
    </li>
  

              
            
              
                
  
  
  
    <li class="md-nav__item">
      <a href="../Filler/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    🐼 Filler
  </span>
  

      </a>
    </li>
  

              
            
              
                
  
  
  
    <li class="md-nav__item">
      <a href="../ByteRecorder/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    🐻 ByteRecorder
  </span>
  

      </a>
    </li>
  

              
            
              
                
  
  
  
    <li class="md-nav__item">
      <a href="../CellStyle/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    🌺 单元格样式
  </span>
  

      </a>
    </li>
  

              
            
              
                
  
  
  
    <li class="md-nav__item">
      <a href="../advance/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    🌳 进阶用法
  </span>
  

      </a>
    </li>
  

              
            
              
                
  
  
  
    <li class="md-nav__item">
      <a href="../attentions/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    ⚠️ 注意事项
  </span>
  

      </a>
    </li>
  

              
            
          </ul>
        </nav>
      
    </li>
  

    
      
      
  
  
  
    <li class="md-nav__item">
      <a href="../../history/" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    版本历史
  </span>
  

      </a>
    </li>
  

    
      
      
  
  
  
    <li class="md-nav__item">
      <a href="https://gitee.com/g1879/DataRecorder/issues" class="md-nav__link">
        
  
  <span class="md-ellipsis">
    意见建议
  </span>
  

      </a>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              
              <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#_1" class="md-nav__link">
    🐘 创建对象
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_2" class="md-nav__link">
    ➕ 添加数据
  </a>
  
    <nav class="md-nav" aria-label="➕ 添加数据">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_3" class="md-nav__link">
    ✔ 记录单个数据
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_4" class="md-nav__link">
    ✔ 接收一行多个数据
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_5" class="md-nav__link">
    ✔ 接收多行数据
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_6" class="md-nav__link">
    🧾 指定工作表
  </a>
  
    <nav class="md-nav" aria-label="🧾 指定工作表">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_7" class="md-nav__link">
    📃 指定默认工作表
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_8" class="md-nav__link">
    📃 每个数据独立指定工作表
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_9" class="md-nav__link">
    💾 写入文件
  </a>
  
    <nav class="md-nav" aria-label="💾 写入文件">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_10" class="md-nav__link">
    ✍ 自动写入
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_11" class="md-nav__link">
    ✍ 手动写入
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_12" class="md-nav__link">
    ⚠️ 注意事项
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_13" class="md-nav__link">
    📑 文件格式
  </a>
  
    <nav class="md-nav" aria-label="📑 文件格式">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_14" class="md-nav__link">
    🔖 自动识别文件格式
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_15" class="md-nav__link">
    🔖 手动指定文件格式
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_16" class="md-nav__link">
    💡 示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_17" class="md-nav__link">
    🌺 设置单元格样式
  </a>
  
    <nav class="md-nav" aria-label="🌺 设置单元格样式">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_18" class="md-nav__link">
    ☘️ 跟随上一行
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_19" class="md-nav__link">
    ☘️ 指定样式
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#recorder" class="md-nav__link">
    ♾️ Recorder 对象的方法
  </a>
  
    <nav class="md-nav" aria-label="♾️ Recorder 对象的方法">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#add_data" class="md-nav__link">
    📌 add_data()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#record" class="md-nav__link">
    📌 record()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#clear" class="md-nav__link">
    📌 clear()
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#recorder_1" class="md-nav__link">
    ⚙️ Recorder 对象参数设置
  </a>
  
    <nav class="md-nav" aria-label="⚙️ Recorder 对象参数设置">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#setpath" class="md-nav__link">
    📌 set.path()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setcache_size" class="md-nav__link">
    📌 set.cache_size()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setfile_type" class="md-nav__link">
    📌 set.file_type()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#settable" class="md-nav__link">
    📌 set.table()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#sethead" class="md-nav__link">
    📌 set.head()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setbefore" class="md-nav__link">
    📌 set.before()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setafter" class="md-nav__link">
    📌 set.after()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setstyle" class="md-nav__link">
    📌 set.style()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setcol_height" class="md-nav__link">
    📌 set.col_height()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setfollow_styles" class="md-nav__link">
    📌 set.follow_styles()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setfit_head" class="md-nav__link">
    📌 set.fit_head()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setencoding" class="md-nav__link">
    📌 set.encoding()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setdelimiter" class="md-nav__link">
    📌 set.delimiter()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setquote_char" class="md-nav__link">
    📌 set.quote_char()
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#setshow_msg" class="md-nav__link">
    📌 set.show_msg()
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#recorder_2" class="md-nav__link">
    🔣 Recorder 对象的属性
  </a>
  
    <nav class="md-nav" aria-label="🔣 Recorder 对象的属性">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#path" class="md-nav__link">
    📌 path
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#type" class="md-nav__link">
    📌 type
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#data" class="md-nav__link">
    📌 data
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#cache_size" class="md-nav__link">
    📌 cache_size
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#table" class="md-nav__link">
    📌 table
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#encoding" class="md-nav__link">
    📌 encoding
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#delimiter" class="md-nav__link">
    📌 delimiter
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#quote_char" class="md-nav__link">
    📌 quote_char
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#before" class="md-nav__link">
    📌 before
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#after" class="md-nav__link">
    📌 after
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#show_msg" class="md-nav__link">
    📌 show_msg
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          
            <div class="md-content" data-md-component="content">
              <article class="md-content__inner md-typeset">
                
                  


  <h1>🐯 Recorder</h1>

<p><code>Recorder</code>的功能简单直观高效实用，只做一个动作，就是不断接收数据，按顺序往文件末尾添加。可以接收单行数据，或二维数据一次写入多行。</p>
<p>支持 csv、xlsx、json、txt 四种格式文件。</p>
<h2 id="_1">🐘 创建对象</h2>
<table>
<thead>
<tr>
<th style="text-align: center;">初始化参数</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>path</code></td>
<td style="text-align: center;"><code>str</code><br><code>Path</code></td>
<td style="text-align: center;"><code>None</code></td>
<td>文件路径，若不存在会自动创建，如存在则在最后追加数据</td>
</tr>
<tr>
<td style="text-align: center;"><code>cache_size</code></td>
<td style="text-align: center;"><code>int</code></td>
<td style="text-align: center;"><code>None</code></td>
<td>缓存数据条数，为<code>0</code>时不自动记录数据</td>
</tr>
</tbody>
</table>
<p><strong>示例：</strong></p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="kn">from</span> <span class="nn">DataRecorder</span> <span class="kn">import</span> <span class="n">Recorder</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="n">r</span> <span class="o">=</span> <span class="n">Recorder</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="s1">&#39;data.csv&#39;</span><span class="p">,</span> <span class="n">cache_size</span><span class="o">=</span><span class="mi">500</span><span class="p">)</span>
</code></pre></div>
<hr />
<h2 id="_2">➕ 添加数据</h2>
<p><code>Recorder</code>支持非常灵活的数据输入，可一次接收单条或多条数据。</p>
<ul>
<li>
<p>接收<code>str</code>、<code>int</code>、<code>float</code>、openpyxl 的<code>Cell</code>对象，或其它类型对象时，将其作为一个数据独占一行来记录。</p>
</li>
<li>
<p>接收<code>list</code>、<code>tuple</code>、<code>dict</code>时，会将其中数据记录为一行。</p>
</li>
<li>
<p>接收二维<code>list</code>或<code>tuple</code>时，会记录为多行。</p>
</li>
</ul>
<h3 id="_3">✔ 记录单个数据</h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="s1">&#39;abc&#39;</span><span class="p">)</span>  <span class="c1"># 接收str数据</span>
<a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="mi">123</span><span class="p">)</span>  <span class="c1"># 接收int数据</span>
<a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">cell</span><span class="p">)</span>  <span class="c1"># 接收openpyxl Cell对象（value为&#39;def&#39;）</span>
</code></pre></div>
<div class="admonition tip">
<p class="admonition-title">Tips</p>
<p>接收 openpyxl 的<code>Cell</code>对象时，会记录其<code>value</code>值。</p>
</div>
<p>文件内容：</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a>abc
<a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a>123
<a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a>def
</code></pre></div>
<hr />
<h3 id="_4">✔ 接收一行多个数据</h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">({</span><span class="s1">&#39;a&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s1">&#39;b&#39;</span><span class="p">:</span> <span class="mi">2</span><span class="p">})</span>  <span class="c1"># 接收dict数据</span>
<a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">([</span><span class="mi">123</span><span class="p">,</span> <span class="s1">&#39;abc&#39;</span><span class="p">])</span>  <span class="c1"># 接收list数据</span>
<a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">((</span><span class="mi">123</span><span class="p">,</span> <span class="s1">&#39;abc&#39;</span><span class="p">))</span>  <span class="c1"># 接收tuple数据</span>
</code></pre></div>
<div class="admonition tip">
<p class="admonition-title">Tips</p>
<p>接收<code>dict</code>数据时，会记录其<code>value</code>值。如果一个新文件，接收的第一条数据是<code>dict</code>格式，会自动根据其<code>key</code>值创建表头。</p>
</div>
<p>文件内容：</p>
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>123</td>
<td>abc</td>
</tr>
<tr>
<td>123</td>
<td>abc</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="_5">✔ 接收多行数据</h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">([{</span><span class="s1">&#39;a&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s1">&#39;b&#39;</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span> <span class="p">{</span><span class="s1">&#39;a&#39;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;b&#39;</span><span class="p">:</span> <span class="mi">4</span><span class="p">}])</span>  <span class="c1"># 接收多个dict</span>
<a id="__codelineno-4-2" name="__codelineno-4-2" href="#__codelineno-4-2"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)])</span>  <span class="c1"># 接收二维list</span>
<a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(((</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)))</span>  <span class="c1"># 接收二维tuple</span>
</code></pre></div>
<p>其中，接收多个<code>dict</code>的数据时，如果是新建文件，会自动以<code>'a'</code>、<code>'b'</code>生成表头。</p>
<p>文件内容：</p>
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</tbody>
</table>
<hr />
<h2 id="_6">🧾 指定工作表</h2>
<p>可为记录器指定要操作的工作表，如工作表不存在，程序会自动创建。</p>
<p>如不对工作表进行任何设置，程序会使用活动工作表。</p>
<p>但只有 xlsx 文件可以指定。</p>
<h3 id="_7">📃 指定默认工作表</h3>
<p>用<code>set.table()</code>方法指定默认工作表，之后所有添加的数据都会默认添加到该工作表。</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a><span class="kn">from</span> <span class="nn">DataRecorder</span> <span class="kn">import</span> <span class="n">Recorder</span>
<a id="__codelineno-5-2" name="__codelineno-5-2" href="#__codelineno-5-2"></a>
<a id="__codelineno-5-3" name="__codelineno-5-3" href="#__codelineno-5-3"></a><span class="n">r</span> <span class="o">=</span> <span class="n">Recorder</span><span class="p">(</span><span class="s1">&#39;demo.xlsx&#39;</span><span class="p">)</span>
<a id="__codelineno-5-4" name="__codelineno-5-4" href="#__codelineno-5-4"></a><span class="n">r</span><span class="o">.</span><span class="n">set</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="s1">&#39;sheet1&#39;</span><span class="p">)</span>
</code></pre></div>
<hr />
<h3 id="_8">📃 每个数据独立指定工作表</h3>
<p>使用<code>add_data()</code>方法的<code>table</code>参数可为每条数据指定工作表。</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="s1">&#39;abc&#39;</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="s1">&#39;sheet2&#39;</span><span class="p">)</span>
</code></pre></div>
<hr />
<h2 id="_9">💾 写入文件</h2>
<h3 id="_10">✍ 自动写入</h3>
<p>当接收数据到达指定条数，会触发写入文件动作，同时清空缓存。</p>
<p>如果写入时文件被打开而无法写入，会自动等待文件关闭再写入。</p>
<p>在写入文件开始和结束时，默认会打印提示，提醒用户此时不要关闭进程。如须设置不显示，可把<code>show_msg</code>参数设置为<code>False</code>。</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-7-1" name="__codelineno-7-1" href="#__codelineno-7-1"></a><span class="kn">from</span> <span class="nn">DataRecorder</span> <span class="kn">import</span> <span class="n">Recorder</span>
<a id="__codelineno-7-2" name="__codelineno-7-2" href="#__codelineno-7-2"></a>
<a id="__codelineno-7-3" name="__codelineno-7-3" href="#__codelineno-7-3"></a><span class="n">r</span> <span class="o">=</span> <span class="n">Recorder</span><span class="p">(</span><span class="s1">&#39;data.csv&#39;</span><span class="p">)</span>
<a id="__codelineno-7-4" name="__codelineno-7-4" href="#__codelineno-7-4"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="mi">123</span><span class="p">)</span>  <span class="c1"># 程序结束时自动写入文件</span>
</code></pre></div>
<hr />
<h3 id="_11">✍ 手动写入</h3>
<p>可在程序中调用<code>record()</code>来提前执行写入动作。</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-8-1" name="__codelineno-8-1" href="#__codelineno-8-1"></a><span class="kn">from</span> <span class="nn">DataRecorder</span> <span class="kn">import</span> <span class="n">Recorder</span>
<a id="__codelineno-8-2" name="__codelineno-8-2" href="#__codelineno-8-2"></a>
<a id="__codelineno-8-3" name="__codelineno-8-3" href="#__codelineno-8-3"></a><span class="n">r</span> <span class="o">=</span> <span class="n">Recorder</span><span class="p">(</span><span class="s1">&#39;data.csv&#39;</span><span class="p">)</span>
<a id="__codelineno-8-4" name="__codelineno-8-4" href="#__codelineno-8-4"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="mi">123</span><span class="p">)</span>
<a id="__codelineno-8-5" name="__codelineno-8-5" href="#__codelineno-8-5"></a><span class="n">r</span><span class="o">.</span><span class="n">record</span><span class="p">()</span>  <span class="c1"># 手动调用写入方法</span>
</code></pre></div>
<hr />
<h3 id="_12">⚠️ 注意事项</h3>
<ul>
<li>
<p>切勿在文件正在写入的时候关闭进程，以免造成文件损坏。</p>
</li>
<li>
<p>强烈建议在程序结束时显式调用<code>record()</code>保存数据。</p>
</li>
</ul>
<hr />
<h2 id="_13">📑 文件格式</h2>
<p><code>Recorder</code>支持 xlsx、csv、json、txt 四种记录格式。</p>
<ul>
<li>xlsx：表格文件，数据内容可保留类型。</li>
<li>csv：表格文件，数据以文本方式记录。</li>
<li>json：以 json 格式记录数据。</li>
<li>txt：每行数据为文本格式，多个数据间用空格分隔。</li>
</ul>
<h3 id="_14">🔖 自动识别文件格式</h3>
<p>指定记录文件路径后，程序会根据文件后缀判断使用哪一种格式。</p>
<p>如果没有后缀或不是这四种之一，会以 csv 方式进行记录。</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-9-1" name="__codelineno-9-1" href="#__codelineno-9-1"></a><span class="n">r</span> <span class="o">=</span> <span class="n">Recorder</span><span class="p">(</span><span class="s1">&#39;abc.csv&#39;</span><span class="p">)</span>  <span class="c1"># 自动以csv方式记录数据</span>
</code></pre></div>
<hr />
<h3 id="_15">🔖 手动指定文件格式</h3>
<p>如果文件路径没有后缀，或想指定与后缀不一致的记录方式，可用<code>set.type()</code>指定记录格式。</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-10-1" name="__codelineno-10-1" href="#__codelineno-10-1"></a><span class="n">r</span> <span class="o">=</span> <span class="n">Recorder</span><span class="p">(</span><span class="s1">&#39;abc&#39;</span><span class="p">)</span>
<a id="__codelineno-10-2" name="__codelineno-10-2" href="#__codelineno-10-2"></a><span class="n">r</span><span class="o">.</span><span class="n">set</span><span class="o">.</span><span class="n">type</span><span class="p">(</span><span class="s1">&#39;csv&#39;</span><span class="p">)</span>
</code></pre></div>
<hr />
<h3 id="_16">💡 示例</h3>
<p>有以下代码：</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-11-1" name="__codelineno-11-1" href="#__codelineno-11-1"></a><span class="n">data</span> <span class="o">=</span> <span class="p">((</span><span class="s1">&#39;姓名&#39;</span><span class="p">,</span> <span class="s1">&#39;年龄&#39;</span><span class="p">),</span>
<a id="__codelineno-11-2" name="__codelineno-11-2" href="#__codelineno-11-2"></a>        <span class="p">(</span><span class="s1">&#39;张三&#39;</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
<a id="__codelineno-11-3" name="__codelineno-11-3" href="#__codelineno-11-3"></a>        <span class="p">(</span><span class="s1">&#39;李四&#39;</span><span class="p">,</span> <span class="mi">22</span><span class="p">))</span>
<a id="__codelineno-11-4" name="__codelineno-11-4" href="#__codelineno-11-4"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
</code></pre></div>
<p><strong>xlsx 格式保存内容：</strong></p>
<table>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
</thead>
<tbody>
<tr>
<td>张三</td>
<td>20</td>
</tr>
<tr>
<td>李四</td>
<td>22</td>
</tr>
</tbody>
</table>
<p>其中姓名列单元格格式为文本，年龄列单元格格式为数字。</p>
<p><strong>csv 格式保存内容：</strong></p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-12-1" name="__codelineno-12-1" href="#__codelineno-12-1"></a>姓名,年龄
<a id="__codelineno-12-2" name="__codelineno-12-2" href="#__codelineno-12-2"></a>张三,20
<a id="__codelineno-12-3" name="__codelineno-12-3" href="#__codelineno-12-3"></a>李四,22
</code></pre></div>
<p><strong>json 格式保存内容：</strong></p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-13-1" name="__codelineno-13-1" href="#__codelineno-13-1"></a><span class="p">[[</span><span class="s2">&quot;\u59d3\u540d&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;\u5e74\u9f84&quot;</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;\u5f20\u4e09&quot;</span><span class="p">,</span><span class="w"> </span><span class="mi">20</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;\u674e\u56db&quot;</span><span class="p">,</span><span class="w"> </span><span class="mi">22</span><span class="p">]]</span>
</code></pre></div>
<p><strong>txt 格式保存内容：</strong></p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-14-1" name="__codelineno-14-1" href="#__codelineno-14-1"></a>姓名 年龄
<a id="__codelineno-14-2" name="__codelineno-14-2" href="#__codelineno-14-2"></a>张三 20
<a id="__codelineno-14-3" name="__codelineno-14-3" href="#__codelineno-14-3"></a>李四 22
</code></pre></div>
<hr />
<h2 id="_17">🌺 设置单元格样式</h2>
<p>可以对新增数据行的单元格样式进行设置，有两种模式：跟随上一行、直接指定样式。</p>
<p>设置样式只对 xlsx 格式文件有效。</p>
<h3 id="_18">☘️ 跟随上一行</h3>
<p>在对已有格式的文件添加数据时，这种方式可以使新行样式自动保持与原有行一致。</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-15-1" name="__codelineno-15-1" href="#__codelineno-15-1"></a><span class="kn">from</span> <span class="nn">DataRecorder</span> <span class="kn">import</span> <span class="n">Recorder</span>
<a id="__codelineno-15-2" name="__codelineno-15-2" href="#__codelineno-15-2"></a>
<a id="__codelineno-15-3" name="__codelineno-15-3" href="#__codelineno-15-3"></a><span class="n">r</span> <span class="o">=</span> <span class="n">Recorder</span><span class="p">(</span><span class="s1">&#39;demo.xlsx&#39;</span><span class="p">)</span>
<a id="__codelineno-15-4" name="__codelineno-15-4" href="#__codelineno-15-4"></a><span class="n">r</span><span class="o">.</span><span class="n">set</span><span class="o">.</span><span class="n">follow_styles</span><span class="p">(</span><span class="n">on_off</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>  <span class="c1"># 设置跟随上一行的样式</span>
<a id="__codelineno-15-5" name="__codelineno-15-5" href="#__codelineno-15-5"></a>
<a id="__codelineno-15-6" name="__codelineno-15-6" href="#__codelineno-15-6"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="s1">&#39;test&#39;</span><span class="p">)</span>
<a id="__codelineno-15-7" name="__codelineno-15-7" href="#__codelineno-15-7"></a><span class="n">r</span><span class="o">.</span><span class="n">record</span><span class="p">()</span>
</code></pre></div>
<hr />
<h3 id="_19">☘️ 指定样式</h3>
<p>也可以创建一个<code>CellStyle</code>对象，指定新行使用这个样式进行添加。</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-16-1" name="__codelineno-16-1" href="#__codelineno-16-1"></a><span class="kn">from</span> <span class="nn">DataRecorder</span> <span class="kn">import</span> <span class="n">Recorder</span>
<a id="__codelineno-16-2" name="__codelineno-16-2" href="#__codelineno-16-2"></a><span class="kn">from</span> <span class="nn">DataRecorder.style</span> <span class="kn">import</span> <span class="n">CellStyle</span>
<a id="__codelineno-16-3" name="__codelineno-16-3" href="#__codelineno-16-3"></a>
<a id="__codelineno-16-4" name="__codelineno-16-4" href="#__codelineno-16-4"></a><span class="n">r</span> <span class="o">=</span> <span class="n">Recorder</span><span class="p">(</span><span class="s1">&#39;demo.xlsx&#39;</span><span class="p">)</span>
<a id="__codelineno-16-5" name="__codelineno-16-5" href="#__codelineno-16-5"></a><span class="n">c</span> <span class="o">=</span> <span class="n">CellStyle</span><span class="p">()</span>  <span class="c1"># 创建样式对象</span>
<a id="__codelineno-16-6" name="__codelineno-16-6" href="#__codelineno-16-6"></a><span class="n">c</span><span class="o">.</span><span class="n">font</span><span class="o">.</span><span class="n">set_color</span><span class="p">(</span><span class="s1">&#39;red&#39;</span><span class="p">)</span>  <span class="c1"># 设置文本颜色</span>
<a id="__codelineno-16-7" name="__codelineno-16-7" href="#__codelineno-16-7"></a><span class="n">r</span><span class="o">.</span><span class="n">set</span><span class="o">.</span><span class="n">style</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>  <span class="c1"># 设置新行样式</span>
<a id="__codelineno-16-8" name="__codelineno-16-8" href="#__codelineno-16-8"></a>
<a id="__codelineno-16-9" name="__codelineno-16-9" href="#__codelineno-16-9"></a><span class="n">r</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="s1">&#39;test&#39;</span><span class="p">)</span>
<a id="__codelineno-16-10" name="__codelineno-16-10" href="#__codelineno-16-10"></a><span class="n">r</span><span class="o">.</span><span class="n">record</span><span class="p">()</span>
</code></pre></div>
<h2 id="recorder">♾️ <code>Recorder</code> 对象的方法</h2>
<h3 id="add_data">📌 <code>add_data()</code></h3>
<p>此方法用于添加数据到缓存，可接收一个、一行或多行数据。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>data</code></td>
<td style="text-align: center;"><code>Any</code></td>
<td style="text-align: center;">必填</td>
<td>可接收任意格式，接收一维<code>list</code>、<code>tuple</code>和<code>dict</code>时记录为一行，接收二维数据时记录为多行</td>
</tr>
<tr>
<td style="text-align: center;"><code>table</code></td>
<td style="text-align: center;"><code>str</code><br><code>bool</code></td>
<td style="text-align: center;"><code>None</code></td>
<td>当前数据要插入的表格名称，仅支持 xlsx 格式。为<code>None</code>表示用<code>set.table()</code>方法设置的值，为<code>bool</code>表示活动的表格</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="record">📌 <code>record()</code></h3>
<p>此方法用于把数据记录到文件，然后清空缓存。可把数据保存到一个新文件。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>new_path</code></td>
<td style="text-align: center;"><code>str</code><br><code>Path</code></td>
<td style="text-align: center;"><code>None</code></td>
<td>文件另存为的路径，会保存新文件</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th style="text-align: center;">返回类型</th>
<th style="text-align: center;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>str</code></td>
<td style="text-align: center;">文件路径</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="clear">📌 <code>clear()</code></h3>
<p>此方法用于清空现有缓存。</p>
<p>参数：无</p>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h2 id="recorder_1">⚙️ <code>Recorder</code> 对象参数设置</h2>
<h3 id="setpath">📌 <code>set.path()</code></h3>
<p>此方法用于设置文件路径，更改时会自动保存缓存数据到文件。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>path</code></td>
<td style="text-align: center;"><code>str</code><br><code>Path</code></td>
<td style="text-align: center;">必填</td>
<td>文件路径</td>
</tr>
<tr>
<td style="text-align: center;"><code>file_type</code></td>
<td style="text-align: center;"><code>str</code></td>
<td style="text-align: center;"><code>None</code></td>
<td>文件类型，为<code>None</code>则从文件名中获取</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setcache_size">📌 <code>set.cache_size()</code></h3>
<p>此方法用于设置缓存大小，指定采集多少条自动记录到文件，为<code>0</code>时不自动记录。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>size</code></td>
<td style="text-align: center;"><code>int</code></td>
<td style="text-align: center;">必填</td>
<td>缓存数据条数</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setfile_type">📌 <code>set.file_type()</code></h3>
<p>此方法用于指定文件类型，无视文件后缀名。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>file_type</code></td>
<td style="text-align: center;"><code>str</code></td>
<td style="text-align: center;">必填</td>
<td>在四种支持的类型中选择</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="settable">📌 <code>set.table()</code></h3>
<p>此方法用于处理 xlsx 文件时指定数据表。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>name</code></td>
<td style="text-align: center;"><code>str</code></td>
<td style="text-align: center;">必填</td>
<td>数据表名称</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="sethead">📌 <code>set.head()</code></h3>
<p>此方法用于给表格文件设置表头，只支持 csv 和 xlsx 格式文件。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>head</code></td>
<td style="text-align: center;"><code>list</code><br><code>tuple</code></td>
<td style="text-align: center;">必填</td>
<td>表头内容</td>
</tr>
<tr>
<td style="text-align: center;"><code>table</code></td>
<td style="text-align: center;"><code>str</code></td>
<td style="text-align: center;"><code>None</code></td>
<td>要设置的表名称，为<code>None</code>则设置活动表格</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setbefore">📌 <code>set.before()</code></h3>
<p>此方法用于设置对象<code>before</code>参数内容，设置前会先保存缓存数据。</p>
<p><code>before</code>内容的用法将在 “进阶用法” 章节说明。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>before</code></td>
<td style="text-align: center;"><code>Any</code></td>
<td style="text-align: center;">必填</td>
<td>每行数据前要添加的内容，单个数据或列表数据皆可</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setafter">📌 <code>set.after()</code></h3>
<p>此方法用于设置对象<code>after</code>参数内容，设置前会先保存缓存数据。</p>
<p><code>after</code>内容的用法将在 “进阶用法” 章节说明。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>after</code></td>
<td style="text-align: center;"><code>Any</code></td>
<td style="text-align: center;">必填</td>
<td>每行数据后要添加的内容，单个数据或列表数据皆可</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setstyle">📌 <code>set.style()</code></h3>
<p>此方法用于设置新增数据的单元格格式，xlsx 格式时才生效。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>style</code></td>
<td style="text-align: center;"><code>CellStyle</code></td>
<td style="text-align: center;">必填</td>
<td>用于设置单元格格式的对象</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setcol_height">📌 <code>set.col_height()</code></h3>
<p>此方法用于设置新增数据的行高，xlsx 格式时才生效。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>height</code></td>
<td style="text-align: center;"><code>float</code></td>
<td style="text-align: center;">必填</td>
<td>行高</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setfollow_styles">📌 <code>set.follow_styles()</code></h3>
<p>此方法用于设置新增数据的的样式和行高是否跟随文档最后一行，xlsx 格式时才生效。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>on_off</code></td>
<td style="text-align: center;"><code>bool</code></td>
<td style="text-align: center;">必填</td>
<td><code>bool</code>类型表示开或关</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setfit_head">📌 <code>set.fit_head()</code></h3>
<p>此方法用于设置<code>dict</code>数据是否自动匹配表头，xlsx 和 csv 格式时才生效。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>on_off</code></td>
<td style="text-align: center;"><code>bool</code></td>
<td style="text-align: center;">必填</td>
<td><code>bool</code>类型表示开或关</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setencoding">📌 <code>set.encoding()</code></h3>
<p>此方法用于设置编码格式。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>encoding</code></td>
<td style="text-align: center;"><code>str</code></td>
<td style="text-align: center;">必填</td>
<td>编码名称</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setdelimiter">📌 <code>set.delimiter()</code></h3>
<p>此方法用于设置 csv 文件分隔符，csv 格式时才生效。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>delimiter</code></td>
<td style="text-align: center;"><code>str</code></td>
<td style="text-align: center;">必填</td>
<td>csv 文件分隔符</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setquote_char">📌 <code>set.quote_char()</code></h3>
<p>此方法用于设置 csv 文件引用符，csv 格式时才生效。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>quote_char</code></td>
<td style="text-align: center;"><code>str</code></td>
<td style="text-align: center;">必填</td>
<td>csv 文件引用符</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h3 id="setshow_msg">📌 <code>set.show_msg()</code></h3>
<p>此方法用于设置是否显示运行信息。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">参数名称</th>
<th style="text-align: center;">类型</th>
<th style="text-align: center;">默认值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>on_off</code></td>
<td style="text-align: center;"><code>bool</code></td>
<td style="text-align: center;">必填</td>
<td><code>bool</code>类型表示开或关</td>
</tr>
</tbody>
</table>
<p><strong>返回：</strong><code>None</code></p>
<hr />
<h2 id="recorder_2">🔣 <code>Recorder</code> 对象的属性</h2>
<h3 id="path">📌 <code>path</code></h3>
<p>此属性以字符串方式返回当前记录的文件路径。可赋值设置。更改时会自动保存缓存数据到文件。</p>
<p><strong>类型：</strong><code>str</code></p>
<hr />
<h3 id="type">📌 <code>type</code></h3>
<p>此属性以字符串方式返回当前文件的类型。可赋值设置，即可无视文件后缀指定记录格式。</p>
<p><strong>类型：</strong><code>str</code></p>
<hr />
<h3 id="data">📌 <code>data</code></h3>
<p>此属性返回当前保存在缓存里的数据。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">返回类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>list</code></td>
<td>非 xlsx 格式文件以<code>list</code>格式返回结果</td>
</tr>
<tr>
<td style="text-align: center;"><code>dict</code></td>
<td>xlsx 格式文件时以<code>dict</code>格式返回结果</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="cache_size">📌 <code>cache_size</code></h3>
<p>此属性返回缓存的大小，表示记录的条数。</p>
<p><strong>类型：</strong><code>int</code></p>
<hr />
<h3 id="table">📌 <code>table</code></h3>
<p>此属性返回当前处理的数据表，处理 xlsx 文件时才生效。</p>
<table>
<thead>
<tr>
<th style="text-align: center;">返回类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><code>str</code></td>
<td>设置具体表名时返回表名字符串</td>
</tr>
<tr>
<td style="text-align: center;"><code>None</code></td>
<td>为<code>None</code>时表示记录到活动表格</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="encoding">📌 <code>encoding</code></h3>
<p>此属性返回当前文件的编码方式，默认为<code>'utf-8'</code>。</p>
<p><strong>类型：</strong><code>str</code></p>
<hr />
<h3 id="delimiter">📌 <code>delimiter</code></h3>
<p>此属性返回 csv 文件使用的分隔符，默认为<code>','</code>。</p>
<p>文件格式为 csv 时才生效。</p>
<p><strong>类型：</strong><code>str</code></p>
<hr />
<h3 id="quote_char">📌 <code>quote_char</code></h3>
<p>此属性返回csv 文件使用的引用符，默认为<code>'"'</code>。</p>
<p>文件格式为 csv 时才生效。</p>
<p><strong>类型：</strong><code>str</code></p>
<hr />
<h3 id="before">📌 <code>before</code></h3>
<p>此属性返回当前对象设置的<code>before</code>内容，<code>before</code>参数内容的用法将在 “进阶用法” 章节说明。</p>
<p><strong>类型：</strong><code>Any</code></p>
<hr />
<h3 id="after">📌 <code>after</code></h3>
<p>此属性返回当前对象设置的<code>after</code>内容，<code>after</code>参数内容的用法将在 “进阶用法” 章节说明。</p>
<p><strong>类型：</strong><code>Any</code></p>
<hr />
<h3 id="show_msg">📌 <code>show_msg</code></h3>
<p>此属性用于设置是否打印程序运行时产生的提示信息。</p>
<p><strong>类型：</strong><code>bool</code></p>





                
              </article>
            </div>
          
          
        </div>
        
          <button type="button" class="md-top md-icon" data-md-component="top" hidden>
            
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12Z"/></svg>
            Back to top
          </button>
        
      </main>
      
        <footer class="md-footer">
  
    
      
      <nav class="md-footer__inner md-grid" aria-label="Footer" >
        
          
          <a href="../introduction/" class="md-footer__link md-footer__link--prev" aria-label="Previous: 💬 概览" rel="prev">
            <div class="md-footer__button md-icon">
              
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
            </div>
            <div class="md-footer__title">
              <span class="md-footer__direction">
                Previous
              </span>
              <div class="md-ellipsis">
                💬 概览
              </div>
            </div>
          </a>
        
        
          
          <a href="../DBRecorder/" class="md-footer__link md-footer__link--next" aria-label="Next: 🐨 DBRecorder" rel="next">
            <div class="md-footer__title">
              <span class="md-footer__direction">
                Next
              </span>
              <div class="md-ellipsis">
                🐨 DBRecorder
              </div>
            </div>
            <div class="md-footer__button md-icon">
              
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4Z"/></svg>
            </div>
          </a>
        
      </nav>
    
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
  
    Made with
    <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
      Material for MkDocs
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      
    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    
    <script id="__config" type="application/json">{"base": "../..", "features": ["navigation.top", "navigation.tracking", "toc.follow", "content.code.copy", "navigation.tabs", "navigation.tabs.sticky", "header.autohide", "navigation.footer"], "search": "../../assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
    
    
      <script src="../../assets/javascripts/bundle.dff1b7c8.min.js"></script>
      
    
  </body>
</html>